/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package biofilter.factories;

import biofilter.data.Sequence.*;
/**
 *
 * @author Daniel Quest
 */
public class BioSequenceFactory {

    public BioSequenceFactory(){

    }

    public BioSequence getBioSequence(String s){
        char type = '.';
        String test = "";
        if (s.length() > 20 )
            test = s.substring(1, 20);
        else test = s;
        NASequence na = new NASequence(test);
        Protein p = new Protein(test);
        if (p.valid(s) == true) type = 'p';
        if (na.valid(test) == true) type = 'n';
        if (type == 'n') return new NASequence(s);
        if (type == 'p') return new Protein(s);
        return null;
    }
}
